package week01.pay;
public class Wallet implements Payable {
    private float value;
    private String message = "现金支付";

    public Wallet(float initMoney) {
        this.value = initMoney;
    }
    @Override
    public float getTotalMoney() {
        return value;
    }
    public void setTotalMoney(float newValue) {
        value = newValue;
    }
    @Override
    public boolean addMoney(float deposit) {
        value += deposit;
        return true;
    }
    /**
     * 支付
     * @param debit
     * @return
     */
    @Override
    public boolean subtractMoney(float debit) {
        if (debit > value) {
            System.out.println(message+"钱不够");
            return false;
        }
        value -= debit;
        return true;
    }
}
